using System;
using System.Collections.Generic;
using System.Text;
using Entities;
using DAL;
using Utility;

namespace BUS
{
    public class tbPhuongThucThanhToanBUS
    {
        public static void Insert(tbPhuongThucThanhToan phuongthucthanhtoan)
        {
            tbPhuongThucThanhToanDAL ptttDAL = new tbPhuongThucThanhToanDAL();
            ptttDAL.Insert(phuongthucthanhtoan);
        }
        public static void Update(tbPhuongThucThanhToan phuongthucthanhtoan)
        {
            tbPhuongThucThanhToanDAL ptttDAl = new tbPhuongThucThanhToanDAL();
            ptttDAl.Update(phuongthucthanhtoan);
        }
        public static void Delete(int iD)
        {
            tbPhuongThucThanhToanDAL ptttDAl = new tbPhuongThucThanhToanDAL();
            ptttDAl.Delete(iD);
        }
        public static tbPhuongThucThanhToanCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbPhuongThucThanhToanDAL ptttDAL = new tbPhuongThucThanhToanDAL();
            return ptttDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbPhuongThucThanhToanCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbPhuongThucThanhToanDAL ptttDAL = new tbPhuongThucThanhToanDAL();
            return ptttDAL.Get(cri.Criter, 0, 0, tbPhuongThucThanhToanColumns.MaPTTT.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbPhuongThucThanhToan GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbPhuongThucThanhToanColumns.MaPTTT.ToString(), Condition.EQUAL, iD);
            tbPhuongThucThanhToanDAL ptDAL = new tbPhuongThucThanhToanDAL();
            tbPhuongThucThanhToanCollection ptttCollection = ptDAL.Get(cri.Criter, 0, 0, tbPhuongThucThanhToanColumns.MaPTTT.ToString(), OrderDirection.ASC.ToString(), out total);
            if (ptttCollection.Count > 0)
                return ptttCollection[0];
            return null;
        }
        public static tbPhuongThucThanhToanCollection GetLimited(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbPhuongThucThanhToanDAL ptttDAL = new tbPhuongThucThanhToanDAL();
            return ptttDAL.Get(cri.Criter, 1, number, tbPhuongThucThanhToanColumns.MaPTTT.ToString(), OrderDirection.DESC.ToString(), out total);
        }
        public static tbPhuongThucThanhToanCollection GetPromotion(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbPhuongThucThanhToanDAL ptttDAL = new tbPhuongThucThanhToanDAL();
            return ptttDAL.Get(cri.Criter, 1, number, tbPhuongThucThanhToanColumns.MaPTTT.ToString(), OrderDirection.DESC.ToString(), out total);
        }
    }
}